package threadingexercise;


// 实现Runnable 接口，重写 run 方法来创建线程
class MyRunnable implements Runnable {
    @Override
    public void run() {
        System.out.println("hello");
    }
    /*public void run2() {
        System.out.println("hello");
    }*/
}

public class ThreadingDemo2 {
    public static void main(String[] args) {
        MyRunnable myRunnable = new MyRunnable();
        //在构造方法中传入Runnable的一个实例
        Thread t = new Thread(myRunnable);

        t.start();
    }
}
